package com.sjm.suchbear.minibookmall.manage;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sjm.suchbear.minibookmall.LoginActivity;
import com.sjm.suchbear.minibookmall.R;
import com.sjm.suchbear.minibookmall.Utils.SP;
import com.sjm.suchbear.minibookmall.Utils.T;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ManageActivity extends Activity {

    @BindView(R.id.ll_header_back)
    LinearLayout llHeaderBack;
    @BindView(R.id.tv_list_title)
    TextView tvListTitle;
    @BindView(R.id.iv_header_function_ico)
    ImageView ivHeaderFunctionIco;
    @BindView(R.id.ll_header_function)
    LinearLayout llHeaderFunction;
    @BindView(R.id.ll_List_Main)
    RelativeLayout llListMain;
    @BindView(R.id.tv_addBook)
    TextView tvAddBook;
    @BindView(R.id.tv_addNotice)
    TextView tvAddNotice;
    @BindView(R.id.tv_updateBook)
    TextView tvUpdateBook;
    @BindView(R.id.tv_updateUser)
    TextView tvUpdateUser;
    @BindView(R.id.tv_updateOrder)
    TextView tvUpdateOrder;
    @BindView(R.id.tv_updateNotice)
    TextView tvUpdateNotice;
    @BindView(R.id.tv_logout)
    TextView tvLogout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manage);
        ButterKnife.bind(this);
        llHeaderBack.setVisibility(View.GONE);
        tvListTitle.setText("管理列表");
    }

    @OnClick({R.id.tv_addBook, R.id.tv_addNotice, R.id.tv_updateBook, R.id.tv_updateUser, R.id.tv_updateOrder, R.id.tv_updateNotice, R.id.tv_logout})
    public void onViewClicked(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.tv_addBook:
                intent = new Intent(ManageActivity.this, AddBookActivity.class);
                intent.putExtra("mode", 0);
                startActivity(intent);
                break;
            case R.id.tv_addNotice:
                intent = new Intent(ManageActivity.this, AddNoticeActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_updateBook:
                intent = new Intent(ManageActivity.this, ListActivity.class);
                intent.putExtra("mode", 0);
                startActivity(intent);
                break;
            case R.id.tv_updateUser:
                intent = new Intent(ManageActivity.this, ListActivity.class);
                intent.putExtra("mode", 1);
                startActivity(intent);
                break;
            case R.id.tv_updateOrder:
                intent = new Intent(ManageActivity.this, ListActivity.class);
                intent.putExtra("mode", 2);
                startActivity(intent);
                break;
            case R.id.tv_updateNotice:
                intent = new Intent(ManageActivity.this, ListActivity.class);
                intent.putExtra("mode", 3);
                startActivity(intent);
                break;
            case R.id.tv_logout:
                SP.setLoginUser(getBaseContext(), "", "", "");
                T.showShort(getBaseContext(), "登出成功");
                intent = new Intent(ManageActivity.this, LoginActivity.class);
                startActivity(intent);
                finish();
                break;
        }
    }
}
